Don't show accelerators in popup menus. (#127227)
authorMatthias Clasen <maclas@gmx.de>
Mon, 24 Nov 2003 23:24:40 +0000 (23:24 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 24 Nov 2003 23:24:40 +0000 (23:24 +0000)
Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkuimanager.c (update_node): Don't show accelerators in
popup menus.  (#127227)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkuimanager.c

index c4e57051f3b2b256d452da089ea75e76be95c945..68f37b89e94b5ef7fed830291f6b98f7e85fcb28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.c (update_node): Don't show accelerators in
+       popup menus.  (#127227)
+
 Mon Nov 24 13:47:39 GMT 2003  Tony Gale <gale@gtk.org>
 
        * docs/faq/gtk-faq.sgml: start 2.x Section 4 updates
index c4e57051f3b2b256d452da089ea75e76be95c945..68f37b89e94b5ef7fed830291f6b98f7e85fcb28 100644 (file)
@@ -1,3 +1,8 @@
+Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.c (update_node): Don't show accelerators in
+       popup menus.  (#127227)
+
 Mon Nov 24 13:47:39 GMT 2003  Tony Gale <gale@gtk.org>
 
        * docs/faq/gtk-faq.sgml: start 2.x Section 4 updates
index c4e57051f3b2b256d452da089ea75e76be95c945..68f37b89e94b5ef7fed830291f6b98f7e85fcb28 100644 (file)
@@ -1,3 +1,8 @@
+Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.c (update_node): Don't show accelerators in
+       popup menus.  (#127227)
+
 Mon Nov 24 13:47:39 GMT 2003  Tony Gale <gale@gtk.org>
 
        * docs/faq/gtk-faq.sgml: start 2.x Section 4 updates
index c4e57051f3b2b256d452da089ea75e76be95c945..68f37b89e94b5ef7fed830291f6b98f7e85fcb28 100644 (file)
@@ -1,3 +1,8 @@
+Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.c (update_node): Don't show accelerators in
+       popup menus.  (#127227)
+
 Mon Nov 24 13:47:39 GMT 2003  Tony Gale <gale@gtk.org>
 
        * docs/faq/gtk-faq.sgml: start 2.x Section 4 updates
index c4e57051f3b2b256d452da089ea75e76be95c945..68f37b89e94b5ef7fed830291f6b98f7e85fcb28 100644 (file)
@@ -1,3 +1,8 @@
+Tue Nov 25 00:10:05 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.c (update_node): Don't show accelerators in
+       popup menus.  (#127227)
+
 Mon Nov 24 13:47:39 GMT 2003  Tony Gale <gale@gtk.org>
 
        * docs/faq/gtk-faq.sgml: start 2.x Section 4 updates
index 0d9ec632cb44eb7245da0ecb8040aed6f2365fb7..d39b017319d904e05b42d6341a230b8eee7bff3f 100644 (file)
@@ -42,7 +42,7 @@
 #include "gtktoolbar.h"
 #include "gtkuimanager.h"
 
-#undef DEBUG_UI_MANAGER
+#define DEBUG_UI_MANAGER
 
 typedef enum 
 {
@@ -1783,7 +1783,7 @@ update_smart_separators (GtkWidget *proxy)
 static void
 update_node (GtkUIManager *self, 
             GNode        *node,
-            gboolean      add_tearoffs)
+            gboolean      in_popup)
 {
   Node *info;
   GNode *child;
@@ -1798,8 +1798,11 @@ update_node (GtkUIManager *self,
 
   info = NODE_INFO (node);
 
+  in_popup = in_popup || (info->type == NODE_TYPE_POPUP);
+
 #ifdef DEBUG_UI_MANAGER
-  g_print ("update_node name=%s dirty=%d (", info->name, info->dirty);
+  g_print ("update_node name=%s dirty=%d popup %d (", 
+          info->name, info->dirty, in_popup);
   for (tmp = info->uifiles; tmp != NULL; tmp = tmp->next)
     {
       NodeUIReference *ref = tmp->data;
@@ -1859,7 +1862,9 @@ update_node (GtkUIManager *self,
              menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
              siblings = gtk_container_get_children (GTK_CONTAINER (menu));
              if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
-               g_object_set (G_OBJECT (siblings->data), "visible", add_tearoffs, 0);
+               g_object_set (G_OBJECT (siblings->data), 
+                             "visible", self->private_data->add_tearoffs && !in_popup, 
+                             NULL);
            }
 
          goto recurse_children;
@@ -1938,7 +1943,9 @@ update_node (GtkUIManager *self,
            menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
            siblings = gtk_container_get_children (GTK_CONTAINER (menu));
            if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
-             g_object_set (G_OBJECT (siblings->data), "visible", add_tearoffs, 0);
+             g_object_set (G_OBJECT (siblings->data), 
+                           "visible", self->private_data->add_tearoffs && !in_popup, 
+                           NULL);
          }
          break;
        case NODE_TYPE_UNDECIDED:
@@ -2075,6 +2082,15 @@ update_node (GtkUIManager *self,
            }
          g_signal_connect (info->proxy, "notify::visible",
                            G_CALLBACK (update_smart_separators), 0);
+         if (in_popup) 
+           {
+             /* don't show accels in popups */
+             GtkWidget *label = GTK_BIN (info->proxy)->child;
+             g_object_set (G_OBJECT (label),
+                           "accel_closure", NULL,
+                           NULL);
+           }
+
          break;
        case NODE_TYPE_TOOLITEM:
          /* remove the proxy if it is of the wrong type ... */
@@ -2193,7 +2209,7 @@ update_node (GtkUIManager *self,
 
       current = child;
       child = current->next;
-      update_node (self, current, add_tearoffs && (info->type != NODE_TYPE_POPUP));
+      update_node (self, current, in_popup);
     }
 
   if (info->proxy) 
@@ -2233,8 +2249,7 @@ do_updates (GtkUIManager *self)
    *    the proxy is reconnected to the new action (or a new proxy widget
    *    is created and added to the parent container).
    */
-  update_node (self, self->private_data->root_node, 
-              self->private_data->add_tearoffs);
+  update_node (self, self->private_data->root_node, FALSE);
 
   self->private_data->update_tag = 0;